/*
 *The code is written by NaLi, All rights reserved.
 */
package com.nali.dal.statement.function;

import java.util.List;

/**
 * @author gavin 
 * Created on 2011-4-11
 */
public abstract class AbstractDataHandler<V> implements DataHandler<V>{
	
	protected void checkSize(List<FunctionArgument> arguments, int s) throws FunctionException {
		checkSize(arguments, s, s);
	}
	
	protected void checkSize(List<FunctionArgument> arguments, int min, int max) throws FunctionException {
		if(arguments.size() > max || arguments.size() < min) {
			if(max==min) {
				throw new FunctionException("Datahandler: " + this.getClass() + ",argumetns' size must be " + max + ":" + arguments.size());
			} else {
				throw new FunctionException("Datahandler: " + this.getClass() +  ",argumetns' size must between [" + min + ", " + max + "]:" + arguments.size());
			}
		}
	}
}

